UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j/C1HnNudsvRYRlIN/gssvvusaZ/FvNtOx5LI0JZG4Q=' 
WHERE 
  key_id = '8f3d58ef3808a7081cf3deddb4ace1c3d90782c2f3acafcc194d019d2856afff' 
  AND (
    token = 'j/C1HnNudsvRYRlIN/gssvvusaZ/FvNtOx5LI0JZG4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023