UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'augIVqlRvYfehITzelMdo7ICl6088cPAL9XYOcguk/Y=' 
WHERE 
  key_id = 'bdd3418cb5e7ac8eea198b86dd9dcf67a447ebe6ba9e4fb7787ce60a8c32cc4e' 
  AND (
    token = 'augIVqlRvYfehITzelMdo7ICl6088cPAL9XYOcguk/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040