UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rhzICqNsK4TptBEvYmlfeJmBUlIKlbtUEueWXCW2rOU=' 
WHERE 
  key_id = '74f0f991b646f0d643a6caf9a5efd3aa31134252fe9c4e4c3227d2bee287b6bd' 
  AND (
    token = 'rhzICqNsK4TptBEvYmlfeJmBUlIKlbtUEueWXCW2rOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033