UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XXr3DsjZK+UbHfTAsY2U7O/+Sf47ebqJDx6FD4J8WcQ=' 
WHERE 
  key_id = '455797ade51cc79a368d6d75cb1f61f7a31e57ecaca3ab8b80c4ceb954d5886f' 
  AND (
    token = 'XXr3DsjZK+UbHfTAsY2U7O/+Sf47ebqJDx6FD4J8WcQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046