UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y/ro+LLe/EdLJfU9R5Zs1gusQFVb52K5ap77zPEGsyM=' 
WHERE 
  key_id = '15f99c8012308730c8c3936bfd5ca39a9be997d1c03d2206f1cb16f9106adbbf' 
  AND (
    token = 'Y/ro+LLe/EdLJfU9R5Zs1gusQFVb52K5ap77zPEGsyM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022