UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qy5hFC6/qvG1f/mM+MNFchzF2Zv6gyAjk4Zeok/iXas=' 
WHERE 
  key_id = '503c72cf54128367a628196b84b9fad1cc42cec1f965b2cc6dc3e48d51551859' 
  AND (
    token = 'Qy5hFC6/qvG1f/mM+MNFchzF2Zv6gyAjk4Zeok/iXas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044