UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+7csPYeXhA97z4S9fCjnmYPQd6PQXigPj2hyN6i9WfM=' 
WHERE 
  key_id = 'b06368215bddf219b4d3538f4a17174662805c736bf466d0becde68712c2604a' 
  AND (
    token = '+7csPYeXhA97z4S9fCjnmYPQd6PQXigPj2hyN6i9WfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038