UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kz5/LXzhZkMpB+0Ebv5SgpwpkpA+o5+3ZfRjIPtQE38=' 
WHERE 
  key_id = '2aeb95d092f3fb5986e40d36503284e626768dfb82792f9be61ecf4db9afdd31' 
  AND (
    token = 'Kz5/LXzhZkMpB+0Ebv5SgpwpkpA+o5+3ZfRjIPtQE38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028