UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v5TwgCxjDR7SeoPIJHM0UJ/YhRPlLVnE0mG1l+ljQWw=' 
WHERE 
  key_id = '9d5b1376bf48d38cc476f4d4adbf55928de1c0b76cfc6ee010f6f4272c34a31e' 
  AND (
    token = 'v5TwgCxjDR7SeoPIJHM0UJ/YhRPlLVnE0mG1l+ljQWw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037