UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y4f9RkqyhH3z+0ck3KqKCgidVBQYRjbkI7qG8hsXlAA=' 
WHERE 
  key_id = '087898db31bef3e503767768eed4e46ee835cab37d663d4d1baaa52da3ddcd47' 
  AND (
    token = 'y4f9RkqyhH3z+0ck3KqKCgidVBQYRjbkI7qG8hsXlAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045