UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nRFVMVS9D/WXnDf53pi4xGi3V4pIDP287gF18JifBdc=' 
WHERE 
  key_id = '1125a0f07b212a3ec52b18e8e9c777d149e0517f227f90e4500c119c74d32072' 
  AND (
    token = 'nRFVMVS9D/WXnDf53pi4xGi3V4pIDP287gF18JifBdc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038