UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y7JZp936wW4HJzhZRy7ljvcCoGVsYo1pS6Pkd2YxyoI=' 
WHERE 
  key_id = '1d25fcb08ba875558b6480478972d255ee95b5ef7703d2ca9fa5f9ab28eef562' 
  AND (
    token = 'Y7JZp936wW4HJzhZRy7ljvcCoGVsYo1pS6Pkd2YxyoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030