UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HsID19CLPWmXTim8/k91LtXQw9OqRxQWn+nGz5eaRRY=' 
WHERE 
  key_id = '3b298d3c8f051347e4a6e394c622e544f864fd65d38d5a6a4acbed198144e5a0' 
  AND (
    token = 'HsID19CLPWmXTim8/k91LtXQw9OqRxQWn+nGz5eaRRY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029