UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MJp//WZkvR1fz9duzbAJvpA8kfuT0WJzEAXE8b02tMs=' 
WHERE 
  key_id = 'a46e523640f7fe40ec7c8e05eebcde5f9f22c44abe58789930ebdb1b243d7942' 
  AND (
    token = 'MJp//WZkvR1fz9duzbAJvpA8kfuT0WJzEAXE8b02tMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026