UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NSuLXLXBQcHUhuu2t6Qqid4Esc6d2fsIj2wOqIGWg7s=' 
WHERE 
  key_id = '4586a8e3b7c263d95003c8cbb9a8b5ff4e8c0c72760007d9b33cfccef75f0083' 
  AND (
    token = 'NSuLXLXBQcHUhuu2t6Qqid4Esc6d2fsIj2wOqIGWg7s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028