UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IdhDXRqM0b5/waiAXRHRXtwX4p7iAKpwkWf+4ptgqDo=' 
WHERE 
  key_id = 'cf25460a61da606174719f667c32a042858b44eb9f59d223a669b0b2cf0e90d0' 
  AND (
    token = 'IdhDXRqM0b5/waiAXRHRXtwX4p7iAKpwkWf+4ptgqDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033