UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zM999e3Q2T5C95H0cLAtN21VgrPibSFybWN/8LTkNO4=' 
WHERE 
  key_id = 'c28d1b0059288665fc203cced6ee4f0c974a7f7270b334e91ed050bf4dc61103' 
  AND (
    token = 'zM999e3Q2T5C95H0cLAtN21VgrPibSFybWN/8LTkNO4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038