UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CR3Me5FxVU+6Wpx/RRkW+7GyLmZMts0AoFYvgtByzDM=' 
WHERE 
  key_id = '2e2816b47506e22a8fb0ea176bb4fb71edfc0963866dba4cbd5a2a73fdfb87f7' 
  AND (
    token = 'CR3Me5FxVU+6Wpx/RRkW+7GyLmZMts0AoFYvgtByzDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029