UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YOH9BFlCZ5WIBdXjhlZZRaVVH6J/iLN1+CryAHenW+U=' 
WHERE 
  key_id = '6cd1d02df2662ca5b536de8902c3e31e36e770a065360d81e8508d225433b72c' 
  AND (
    token = 'YOH9BFlCZ5WIBdXjhlZZRaVVH6J/iLN1+CryAHenW+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045