UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Oos7WGlLu2sWG9VRwM5UQadcRfuEFQvVPRfKZz6FLtA=' 
WHERE 
  key_id = '0dbcd10259d16eb2a0b2de4b926ae0b5947217488164626278c677b701709417' 
  AND (
    token = 'Oos7WGlLu2sWG9VRwM5UQadcRfuEFQvVPRfKZz6FLtA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029