UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cl6ko09oVnOXa0AotP/zm8Yc/kMpJnZwo9y5GOyiY0o=' 
WHERE 
  key_id = '946a974b45f6f8c314055d08ecdc297cf096d643b2e127670eb969c5cec5a0fd' 
  AND (
    token = 'Cl6ko09oVnOXa0AotP/zm8Yc/kMpJnZwo9y5GOyiY0o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028