UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yrxRRZbCMyhdWqqm2rGuBCRJaTXnMgiWXBPI2qhwB2Y=' 
WHERE 
  key_id = '98b7a4d635375203937f19720627cb7bfdd98b7f4b7352212a98c189feea689a' 
  AND (
    token = 'yrxRRZbCMyhdWqqm2rGuBCRJaTXnMgiWXBPI2qhwB2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034