UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KwCZ/aSXrD4vbUoJ1jb5+FgoGM75EbqfUUYAYVNF91M=' 
WHERE 
  key_id = '91feb7ca62b20bc4327769f9a0f9345781b4bd1abd403e772e04d8a5bfc7185b' 
  AND (
    token = 'KwCZ/aSXrD4vbUoJ1jb5+FgoGM75EbqfUUYAYVNF91M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024