UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l4/UJiqHPNfF0YNmJ2TqqbcOqEhOcG1iIajLk0IcSB0=' 
WHERE 
  key_id = '316142bf8f35349e08da35eacd3b75d0397557a5bd2202f08586fc393450ad77' 
  AND (
    token = 'l4/UJiqHPNfF0YNmJ2TqqbcOqEhOcG1iIajLk0IcSB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032