UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'plOQFlGW+7AocWzqUIjD9dhZ9LmIcsuYr5oSei+Fm/0=' 
WHERE 
  key_id = 'be8190675da1785447272a2aae286791658ec2ce8b5e85165b9c650779199136' 
  AND (
    token = 'plOQFlGW+7AocWzqUIjD9dhZ9LmIcsuYr5oSei+Fm/0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025