UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HlGtO2YgeeoQp7x8gy5fdz4rkT6FQvG9S7r9lJbnWjw=' 
WHERE 
  key_id = '58c19e2a77710d4300760b8e1394a93535f950a3d23e5526347cc27dfb9c2311' 
  AND (
    token = 'HlGtO2YgeeoQp7x8gy5fdz4rkT6FQvG9S7r9lJbnWjw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033