UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BH0oE3qtQD3F//ZX5NJfqoEGJ9CVrbDBRis2VIgUr58=' 
WHERE 
  key_id = '90e18a034edecab6d53f527ce20941a4e3ee7239dd50c306b2da34258f21bc5b' 
  AND (
    token = 'BH0oE3qtQD3F//ZX5NJfqoEGJ9CVrbDBRis2VIgUr58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040