UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XDHplPimOOB5FtubHkEUAnrKwdxP0tagzxNhCM1dD+A=' 
WHERE 
  key_id = '03a5a9bf5da3774d0f25960a2ba1761b85f541b082ae348fa521c26301d11684' 
  AND (
    token = 'XDHplPimOOB5FtubHkEUAnrKwdxP0tagzxNhCM1dD+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045