UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FjOFhr1wx9czrlD9Ka9l2YNzgd+d5w8ARbOB1Sx6D/I=' 
WHERE 
  key_id = '31806fb90533298cc29cee4c6f4e4cea766b2f1ec9888d4fb59c1d5fec58b69d' 
  AND (
    token = 'FjOFhr1wx9czrlD9Ka9l2YNzgd+d5w8ARbOB1Sx6D/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042