UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3gapvxhbVTZ5iWBaoZNc78FwZys7JBA9i9ZwHbUuqps=' 
WHERE 
  key_id = 'b46e0960c2b6fa23bc88f15d27525599252067157933313d06d41954cef92ed2' 
  AND (
    token = '3gapvxhbVTZ5iWBaoZNc78FwZys7JBA9i9ZwHbUuqps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038