UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v7vr7PuZ2z8qStE6Pj2LU0GbT54Z/6RJ+W5urgfm2xA=' 
WHERE 
  key_id = '47778645de72fe87549b5260560a9d394c3c770d560173508ac53263b913e2c0' 
  AND (
    token = 'v7vr7PuZ2z8qStE6Pj2LU0GbT54Z/6RJ+W5urgfm2xA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040