UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C8M2uuwgbW1QPm39az1v5MIovANUBIO53kzQUwaH95M=' 
WHERE 
  key_id = '654fef4b3df24ab72cfeaf08fadba3cdc3066ed71afd76bb945cd3ed286804b5' 
  AND (
    token = 'C8M2uuwgbW1QPm39az1v5MIovANUBIO53kzQUwaH95M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044