UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vk28DPoDZtTRW3mcTIbAaYrgCyTN4pIQ/Kgc75WhCXM=' 
WHERE 
  key_id = '074421c16643a8179dc8ba7f0506eccd4cb1394263877eff8580f0084fe8439b' 
  AND (
    token = 'Vk28DPoDZtTRW3mcTIbAaYrgCyTN4pIQ/Kgc75WhCXM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037