UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K3P6VeDvPF+H9LVAq5CAieLg384mdyDY2OVmyvmfC/U=' 
WHERE 
  key_id = '3e813ef98004130885d895d42ef520cf7951fe4fb7497aea4093e4d152b0197a' 
  AND (
    token = 'K3P6VeDvPF+H9LVAq5CAieLg384mdyDY2OVmyvmfC/U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029