UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RtStfa7yleUEhsSfEgEyNZyU4LNgI75vLtinHslVbxc=' 
WHERE 
  key_id = '8a9a431e03989846b12843203936001cef084948e8ba84e121e8706c8f507693' 
  AND (
    token = 'RtStfa7yleUEhsSfEgEyNZyU4LNgI75vLtinHslVbxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024